package com.xiaopengwei.springboot.file.upload.controller;import org.springframework.web.bind.annotation.ControllerAdvice;import org.springframework.web.bind.annotation.ExceptionHandler;import org.springframework.web.multipart.MultipartException;import org.springframework.web.servlet.mvc.support.RedirectAttributes;/** * <p> * 全局异常处理 * </p> * * @author XiaoPengwei.com * @since 2019-04-17 */@ControllerAdvicepublic class GlobalExceptionHandler {    //https://jira.spring.io/browse/SPR-14651    //4.3.5 supports RedirectAttributes redirectAttributes    @ExceptionHandler(MultipartException.class)    public String handleError1(MultipartException e, RedirectAttributes redirectAttributes) {        redirectAttributes.addFlashAttribute("message", e.getCause().getMessage());        return "redirect:/uploadStatus";    }}